home *** CD-ROM | disk | FTP | other *** search
- Path: news.luc.edu!user
- From: VArase@varase.it.luc.edu (Verne Arase)
- Newsgroups: comp.lang.c
- Subject: Re: Borland C's tmpnam()
- Date: Mon, 01 Apr 1996 16:16:52 -0600
- Organization: LUMC
- Message-ID: <AD85B1F49668E2D54@mcdiala11.it.luc.edu>
- References: <AD75E5DC9668E2A52@mcdiala13.it.luc.edu> <Pine.A32.3.91.960322134158.23347A-100000@red.weeg.uiowa.edu> <AD78E5E796681EC58@mcdialb10.it.luc.edu> <827626790snz@genesis.demon.co.uk> <AD7CDFD39668AABD2@mcdiala01.it.luc.edu> <828276946snz@genesis.demon.co.uk> <AD84A73496681719A2@mcdiala03.it.luc.edu> <Pine.A32.3.91.960331232036.17351F-100000@red.weeg.uiowa.edu>
- NNTP-Posting-Host: 147.126.240.111
-
- In article <Pine.A32.3.91.960331232036.17351F-100000@red.weeg.uiowa.edu>,
- The Amorphous Mass <robinson@blue.weeg.uiowa.edu> wrote:
-
- >> All it does it insure that the file name doesn't exist in the current
- >> location in the file system. Which, I'd imagine, is what just about
- every
- >> implementation does.
- >
- > As far as the file system is concerned, two files named "foo" in
- >different directories _don't_ have the same name, because the full
- >pathname is used as a unique identifier. Note that versions of C for the
-
- >original Mac file system (which only provided the illusion of folders,
- >and didn't allow any two files to have the same name) would in fact have
- >had to come up with a totally unique filename.
-
- As MFS only created the _illusion_ of folders, all files _were_ in the same
- location in the file system.
-
- As for the file names returned tmpnam(), they are _not_ complete path
- names. Therefore, they are only unique at the branch of the file system
- which is currently the default location.
-
- >> It's be a lot more useful if you could specify a target directory,
- though
- >> the string that makes up that specification would be target environment
- >> dependant.
- >
- > If it's a temporary file, does it really matter where it ends up? You
- >can always rename() it to another directory (using an implementation-
- >specific string) if you want to keep it after the program terminates.
-
- I'm using
-
- 1) Create a temporary
- 2) Update master into temporary
- 3) Delete master (or rename it to master.old)
- 4) Rename temporary to master
-
- type logic. Creating the temporary file in the master's directory allows
- you to detect whether you have privilege or disk space problems early in
- processing (and before you blow away the old master).
-
- ---
- The above are my own opinions, and not those of my employer.
-